function showThemeDetails(theme)
{		
		var theme_id =  $(theme).attr('name');
		$('#theme-details>legend').html($(theme).find('.theme-nom').html());
		$('#modele-theme-details').find('img').attr('src', $(theme).find('img').attr('src'));
		$('#modele-theme-details').find('.theme-nom').html($(theme).find('.theme-nom').html());
		$('#modele-theme-details').find('.theme-description').html($(theme).find('.theme-description').html());
		$('#modele-theme-details').find('.theme-auteur').html($(theme).find('.theme-auteur').html());
		$('#modele-theme-details').find('a.definirTheme').attr('name', theme_id);
		$('#modele-theme-details').find('a.editerCSS').attr('href', 'index.php?module=CSS&theme='+theme_id);
		$('#modele-theme-details').find('a.gererGadgets').attr('href', 'index.php?module=gadgets&theme='+theme_id);
		$('#theme-details-wrapper').html($('#modele-theme-details').html());
		
		if($(theme).hasClass('default-theme')) {
			$('#theme-details-wrapper').find('a.definirTheme').parent().html(cp.msg.votre_theme_defaut);
		}
}

$(document).ready(function() {
	
	showThemeDetails($('.default-theme'));
	$('.default-theme').addClass('theme-selected');
	
	$('div.theme').click(function() {
		var theme = this;
		
		if(!$(theme).hasClass('theme-selected')) {
			
			$('.theme').removeClass('theme-selected');
			$(theme).addClass('theme-selected');
			
			$('#theme-details-wrapper').fadeOut('fast', function() {
				showThemeDetails(theme);
				$('#theme-details-wrapper').fadeIn('fast');
			});
		}
		return false;
	});
	
	$('a.definirTheme').live('click', function() {
		$('#theme_id').val($(this).attr('name'));
		$('#formModifierTheme').submit();
		return false;
	});
	
});